require(["core", "jQuery", "coAjax", "queryString", "href", "Cookies"], function(jSouper, $, coAjax, QueryString, href, Cookies) {
	var queryString = new QueryString;
	App.set("$Cache.admin_login.username", Cookies.get("cache_admin_login_name"))
	App.set("$Event.admin_login.login", function(e) {
		var username = $.trim(App.get("$Cache.admin_login.username"));
		var password = $.trim(App.get("$Cache.admin_login.password"));
		if (username == "") {
			alert("warn", "用户名不能为空");
		} else if (password == "") {
			alert("warn", "密码不能为空");
		} else {
			var userinfo = {
				"username": username,
				"password": password
			};
			coAjax.post(appConfigPub.admin.sign_in_url, {
				name: username,
				password: password
			}, function(result) {
				alert("success", "管理员登录成功");
				var admin_info = result.result;
				App.set("admin_loginer", admin_info);
				var callbackUrl = queryString.get("cb_url");
				Cookies.set("cache_admin_login_name", username);
				if (callbackUrl) {
					location.href=callbackUrl;
				} else {
					location.href="/dotnar.admin.html";
				}
			}, function(errorCode, xhr, errorMsg) {
				alert("error", errorMsg);
			});
		}
	});
});